package com.zx.crowdfunding.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>菜单实体类</p>
 * 
 * <p>必须要实现序列化接口，因为SpringSession当把对象存入数据库时需要用到序列化，
 * 在用户登录成功后会查询当前用户所拥有的菜单列表，并存入Session中，
 * 所以菜单实体类需要实现序列化接口，不然会抛出异常。</p>
 * 
 * @author 郑雪
 * @date 2021-12-17
 */
public class Menu implements Serializable{
	private static final long serialVersionUID = 1L;

	private Integer id;

    private Integer pid;

    private String name;

    private String url;

    private String icon;
    
    private List<Menu> children = new ArrayList<Menu>();
    
    private Boolean open;

    public Menu() {}

	public Menu(Integer id, Integer pid, String name, String url, String icon,
			List<Menu> children, Boolean open) {
		super();
		this.id = id;
		this.pid = pid;
		this.name = name;
		this.url = url;
		this.icon = icon;
		this.children = children;
		this.open = open;
	}

	@Override
	public String toString() {
		return "Menu [id=" + id + ", pid=" + pid + ", name=" + name + ", url="
				+ url + ", icon=" + icon + ", children=" + children + ", open="
				+ open + "]";
	}

	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon == null ? null : icon.trim();
    }

	public List<Menu> getChildren() {
		return children;
	}

	public void setChildren(List<Menu> children) {
		this.children = children;
	}

	public Boolean getOpen() {
		return open;
	}

	public void setOpen(Boolean open) {
		this.open = open;
	}
}